package com.msh.artascope.devcloud.service.service;

import com.msh.artascope.devcloud.client.po.EnvPo;
import com.msh.artascope.devcloud.client.po.JenkinsConfigPo;
import com.msh.artascope.devcloud.service.model.page.ProjectListPageQo;
import com.msh.artascope.devcloud.service.model.page.ProjectListPageVo;
import com.msh.artascope.devcloud.service.model.query.ProjectQueryVo;
import com.msh.artascope.devcloud.service.model.vo.ProjectVo;
import com.msh.artascope.devcloud.client.po.ProjectPo;
import com.msh.artascope.devcloud.client.qo.ProjectQo;
import com.msh.frame.client.base.TenantBaseService;
import com.msh.frame.client.common.Result;
import com.msh.frame.client.model.TreeVo;

import java.util.List;

/**
 * @author shihu
 * @mail m-sh@qq.com
 */
public interface ProjectService extends TenantBaseService<ProjectPo,ProjectQo> {
  ProjectPo getByModuleId(Long moduleId, Long tenantId);

  /**
   * 获取产品下所有 项目列表
   * @return
   */
  ProjectListPageVo projectListPageVo(ProjectListPageQo projectListPageQo, Long tenantId);
  ProjectListPageVo projectListPageVoByModuleId(Long moduleId, Long tenantId);

  List<EnvPo> copyEnableEnv(String projectName, Long tenantId);

  ProjectPo copy(Long id, Long envId, Long tenantId);

  ProjectPo copy(ProjectPo source, Long envId);

  ProjectPo copy(ProjectPo source, JenkinsConfigPo jenkinsConfigPo, EnvPo envPo);

  long insert(ProjectPo param, JenkinsConfigPo jenkinsConfigPo, EnvPo envPo);

// ----------前端vo处理-------------------------------------------------------

  ProjectVo insertVo(ProjectVo projectVo);

  /**
   * id查询
   * @param id 主键id
   * @return  查询Vo列表
   */
  ProjectVo getVo(Long id, Long tenantId);

  /**
   * 查询
   * @param q 查询QueryVo
   * @return  查询Vo列表
   */
  List<ProjectVo> listVo(ProjectQueryVo q);

  /**
   * 分页查询
   * @param q 查询QueryVo
   * @return  分页查询Po列表
   */
  Result<List<ProjectVo>> pageVo(ProjectQueryVo q);


  List<TreeVo> listProductProjectTree(ProjectQueryVo q);

}
